<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/6/29
 * Time: 17:13
 */

use Biz\service\GoodsDetail as sGoodsDetail;
use Biz\tools\GoodsExposureLog;

/**
 * @deprecated
 */
class InfoByPhotoIdAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {

        $photoId = $this->getRequest()->getQuery('photo_id', '');
		$noteId = $this->getRequest()->getQuery('note_id', '');
		$type = $this->getRequest()->getQuery('type', 0);
        if (version_compare($this->appVersion, '3.6.0', '<')) {
            $goodsInfo = sGoodsDetail::getGoodsInfoByPhotoId($photoId);
        } else {
            $provinceId = $this->getRequest()->getQuery('province_id', '');
            $cityId = $this->getRequest()->getQuery('city_id', '');
            $page = $this->getRequest()->getQuery('page', 0);
            $areaCode = $cityId ? $cityId : $provinceId;
            if (version_compare($this->appVersion, '3.10.0', '<')) {
				$goodsInfo = sGoodsDetail::getGoodsInfoByPhotoId_3_6($photoId, $areaCode, $this->appVersion,$page);
			} else {
            	if ($type) {
					$goodsInfo = sGoodsDetail::getGoodsInfoByPhotoId3_10($noteId, $areaCode, $page);
				} else {
					$goodsInfo = sGoodsDetail::getGoodsInfoByPhotoId_3_6($noteId, $areaCode,$this->appVersion, $page);
				}
			}
        }
        $this->setSuccess($goodsInfo);
        GoodsExposureLog::addLog($this->getRequest(), $goodsInfo,$photoId);
    }
}